import csv

# data = [('肖申克的救赎', '9.7', '希望让⼈⾃由'), ('霸王别姬', '9.6', '⻛华绝代'),('阿⽢正传', '9.5', '⼀部美国近现代史')]
#
# head = ('电影名称', '评分', '引言')
#
# with open("douban.csv",'w',encoding='utf-8-sig',newline='') as f:
#
#     w = csv.writer(f)
#     w.writerow(head)
#     w.writerows(data)

data1 = [
 {'标题': '肖申克的救赎', '评分': '9.7', '引⾔': '希望让⼈⾃由'},
 {'标题': '霸王别姬', '评分': '9.6', '引⾔': '⻛华绝代'},
 {'标题': '阿⽢正传', '评分': '9.5', '引⾔': '⼀部美国近现代史'}
]

head1 = ('标题', '评分', '引⾔')

with open('douban001.csv', 'w', encoding='utf-8-sig', newline='') as f:
    w = csv.DictWriter(f, fieldnames=head1)
    w.writeheader()
    w.writerows(data1)